<#assign c = JspTaglibs["http://java.sun.com/jsp/jstl/core"] >
<#assign fmt = JspTaglibs["http://java.sun.com/jsp/jstl/fmt"] >
<#assign sp = JspTaglibs["http://www.springframework.org/tags"] >

<div style="overflow-x:scroll;">
<div>
	<table style="width:100%;border-collapse:separate; border-spacing:0px 4px;">
	<tr>
	<!--  根据目前需求，不用月份查询，改为日历点击确定时间。注释保留这段代码，以备将来万一还要使用。
		<th style="width:70px;text-align:right;padding:6px;"><@sp.message code="input.state.queryYear" /></th>
		<td style="width:70px;align:left;padding:6px;">
			<select class="form-control" id="year" required [(ngModel)]="cuYear" name="year">
				<option *ngFor="let p of optionYears" [value]="p">{{p}}</option>
			</select>
		</td>
		<th style="width:70px;align:right;padding:6px;"><@sp.message code="input.state.queryMonth" /></th>
		<td style="width:70px;align:left;padding:6px;">
			<select class="form-control" id="month" required [(ngModel)]="cuMonth" name="month">
				<option *ngFor="let p of optionMonths" [value]="p">{{p}}</option>
			</select>
		</td>
		<td  style="text-align:left;padding-left:20px;">
			<input  type="button"  value="<@sp.message code='input.state.query' />" (click)="queryInputDataState()"/>
		</td>
	-->
	
		<!-- <td style="width:70px;align:left;padding:6px;">
			<input type="date" [(ngModel)]="newDate"/>
		</td>  -->
		
		<td style="float:left;margin-left:10px;">
		<p-calendar [(ngModel)]="newDate" dateFormat="yymmdd" [locale]="calLang"></p-calendar>
		</td>
	
		<td  style="text-align:left;padding-left:20px;float:left;">
			<input  type="button"  value="<@sp.message code='input.state.query' />" (click)="queryInputDataState()"/>
		</td>
		
		
		
	</tr>
	
</table>
</div>

<table class="resultTable" *ngIf="inputStates"><caption style="font-size:20px;"><@sp.message code="input.state.list"/></caption>
	<tr>
		<th><@sp.message code="input.state.systemName"/></th>
		<!-- <th><@sp.message code="input.state.dataYear"/></th> 注释备用-->
		<!-- <th><@sp.message code="input.state.dataMonth"/></th> 注释备用-->
		<th><@sp.message code="input.state.data"/></th>
		<th><@sp.message code="input.state.status"/></th>
		<th><@sp.message code="input.state.inputAt"/></th>
		<th><@sp.message code="input.state.Operation"/></th>
	</tr>
	<tr *ngFor="let inputState of inputStates" (click)="selectTable(inputState)" [class.selected]="inputState.isSelected">
		<td>{{inputState.extDataSource.name}}</td>
		<td style="text-align:center;">{{inputState.dataDate}}</td>
		<!-- <td>{{inputState.dataDate | slice:4:8}}</td> 注释备用-->
		<td style="text-align:center;">
		<span *ngIf="inputState.status=='COMPLETE'">已完成</span>
		<span *ngIf="inputState.status!='COMPLETE'">未完成</span>
		</td>
		<td style="text-align:center;">{{inputState.completeTime}}</td>
		<!-- <td>{{formatDate(inputState.inputAt,'yyyy-MM-dd hh:mm:ss')}}</td>  -->
		<td style="text-align:center;">
		<a *ngIf="inputState.status=='COMPLETE'" href="javascript:void" 
		(click)="getDataDetail(inputState.extDataSource.code)">
		<@sp.message code='input.state.details'/></a>
		<a *ngIf="inputState.status!='COMPLETE'" href="javascript:void" (click)="errorDataDetail()">
		<@sp.message code='input.state.details'/></a>
		</td>
	</tr>
</table >
<br/>

<table  class="resultTable" *ngIf="dataDetail"><caption><@sp.message code="table.detail"/></caption>
	<!-- 首先，开始表的标题行展现 -->
	<thead>
	<tr>
		<th *ngFor="let column of tableDetail.dataTable.columns" [attr.style]="sanitizer.bypassSecurityTrustStyle(column.style)">{{column.name}}</th>
	</tr>
	</thead><tbody>
	<!-- 其次，开始表的内容行 -->
	
	<tr *ngFor="let rowInfo of tableDetail.datas" >
		<td *ngFor="let cell of rowInfo; let index=index" [attr.style]="sanitizer.bypassSecurityTrustStyle(tableDetail.dataTable.columns[index].style)">
			<span *ngIf="tableDetail.dataTable.columns[index].options">
			{{tableDetail.dataTable.columns[index].options[cell]}}
			</span >
			<span *ngIf="!tableDetail.dataTable.columns[index].options">
				{{cell}}
			</span>
		</td>
	</tr>
	</tbody>
</table>
</div>
<br />

<message-box [isRunning]="isRunning()"></message-box>